<?php
class Advert extends Blocks {

	private $_block_name = 'advert';

	// Run function
	function run($block_settings = array())
	{
		switch(key($block_settings))
		{
			case "slider":
				$CI = & get_instance();
				$CI->load->model('adv_m');
				$CI->adv_m->order_by('order','ASC');
                $this->data = new stdClass();
				$this->data->adv = $CI->adv_m->get_many_where(array('is_active'=>1,'location'=>1));
				return $this->display($this->_block_name, 'block_slide',$this->data);
			break;
		}
	}

	// Install function (executed when the user installs the widget)
	function install()
	{
		$title = 'title';
		$description = 'latest news';
		$this->install_block($this->_block_name,$title,$description);
	}

	// Uninstall function (executed when the user uninstalls the widget)
	function uninstall()
	{
		$this->uninstall_block($this->_block_name);
	}
}
?>